<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        exclude-result-prefixes="xsd"
        version="1.0"
        >

<xsl:output method="text" indent="no" />

<xsl:key name="paths-key" match="/log/logentry/paths" use="path" />

<xsl:template match="/">
<xsl:variable name='commits' select='100' />

<xsl:for-each select="log/logentry[position() &lt;= $commits]">
-- <xsl:value-of select="@revision" />: <xsl:value-of select="substring(translate(date, 'T', ' '), 1, 19)"/>, by <xsl:value-of select="author" />
<xsl:text>&#xa;</xsl:text>
<xsl:if test='string-length(normalize-space(string(msg)))=0'>Why message ain&apos;t left</xsl:if>
<xsl:value-of select="msg" />
<xsl:text>&#xa;</xsl:text>
<xsl:variable name='a' select="count(paths/path[@action='A'])" />
<xsl:variable name='m' select="count(paths/path[@action='M'])" />
<xsl:variable name='d' select="count(paths/path[@action='D'])" />
<xsl:if test="$a>0 and $m>0 and $d>0">(+) <xsl:value-of select="$a"/>, (-) <xsl:value-of select="$d"/>, (*) <xsl:value-of select="$m"/></xsl:if>
<xsl:if test="$a>0 and $m=0 and $d=0">(+) <xsl:value-of select="$a"/></xsl:if>
<xsl:if test="$a=0 and $m>0 and $d=0">(*) <xsl:value-of select="$m"/></xsl:if>
<xsl:if test="$a=0 and $m=0 and $d>0">(-) <xsl:value-of select="$d"/></xsl:if>
<xsl:if test="$a=0 and $m>0 and $d>0">(-) <xsl:value-of select="$d"/>, (*) <xsl:value-of select="$m"/></xsl:if>
<xsl:if test="$a>0 and $m=0 and $d>0">(+) <xsl:value-of select="$a"/>, (-) <xsl:value-of select="$d"/></xsl:if>
<xsl:if test="$a>0 and $m>0 and $d=0">(+) <xsl:value-of select="$a"/>, (*) <xsl:value-of select="$m"/></xsl:if>
<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>

                        <xsl:variable name="selectedDate" select="text()"/>
                        
                        
                        <xsl:for-each select="following-sibling::msg">
                                * <xsl:variable name="msg" select="text()"/>
                                <xsl:variable name="date" select="preceding-sibling::date/text()"/>
                                <xsl:if test="$selectedDate = $date">
                                        <xsl:text>   </xsl:text>
                                        <xsl:value-of select="$msg"/>
                                </xsl:if>
                        </xsl:for-each>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>